#ifndef CLASS_MANAGER_GRAPHICS_CONFIGURATION_HPP_
# define CLASS_MANAGER_GRAPHICS_CONFIGURATION_HPP_

# ifdef MANAGER_GRAPHICS_INCLUDE_CONFIGURATION_

#  include <string>

class	Configuration
{
public:
  explicit Configuration(int unsigned w = 800, int unsigned h = 600, int short unsigned c = 24,
						 std::string const &cap = "Game", bool win = true)
	:	_width(w), _height(h), _color(c),
		_ratiow((float)_width), _ratioh((float)_height),
		_caption(cap),
		_windowed(win), _vsync(!_windowed),
		_framerate(0),
		_opengl(false)
  {
  }
  Configuration(Configuration const &c)
	:	_width(c._width), _height(c._height), _color(c._color),
		_ratiow(c._ratiow), _ratioh(c._ratioh),
		_caption(c._caption),
		_windowed(c._windowed), _vsync(c._vsync),
		_framerate(c._framerate),
		_opengl(c._opengl)
  {
  }

  Configuration const	&operator=(Configuration const &c)
  {
	if (this != &c)
	  {
		this->_width = c._width; this->_height = c._height; this->_color = c._color;
		this->_ratiow = c._ratiow; this->_ratioh = c._ratioh;
		this->_caption = c._caption;
		this->_windowed = c._windowed; this->_vsync = c._vsync;
		this->_framerate = c._framerate;
		this->_opengl = c._opengl;
	  }

	return (*this);
  }

  int unsigned			Width() const throw()
  { return (this->_width); }
  int unsigned			Width(int unsigned w) throw()
  { this->_width = w; return (this->_width); }
  int unsigned			Height() const throw()
  { return (this->_height); }
  int unsigned			Height(int unsigned h) throw()
  { this->_height = h; return (this->_height); }

  int short unsigned	Color() const throw()
  { return (this->_color); }
  int short unsigned	Color(int short unsigned col) throw()
  { this->_color = col; return (this->_color); }

  float					Ratio() const throw()
  { return (_ratiow / _ratioh); }
  float					Ratio(float rw, float rh) throw()
  { this->_ratiow = rw; this->_ratioh = rh; return (_ratiow / _ratioh); }
  float					Ratio(float r) throw()
  {
	if (r >= 16.f / 9.f - .0001f && r <= 16.f / 9.f + .0001f)
	  { this->_ratiow = 16.f; this->_ratioh = 9.f; }
	else if (r >= 16.f / 10.f - .0001f && r <= 16.f / 10.f + .0001f)
	  { this->_ratiow = 16.f; this->_ratioh = 10.f; }
	else
	  { this->_ratiow = 4.f; this->_ratioh = 3.f; }
	return (_ratiow / _ratioh);
  }

  std::string const		&Caption() const throw()
  { return (this->_caption); }
  std::string const		&Caption(std::string const &cap) throw()
  { this->_caption = cap; return (this->_caption); }

  bool					Windowed() const throw()
  { return (this->_windowed); }
  bool					Windowed(bool w) throw()
  { this->_windowed = w; return (this->_windowed); }

  bool					VSync() const throw()
  { return (this->_vsync); }
  bool					VSync(bool v) throw()
  { this->_vsync = v; return (this->_vsync); }

  int unsigned			Framerate() const throw()
  { return (this->_framerate); }
  int unsigned			Framerate(int unsigned f) throw()
  { this->_framerate = f; return (this->_framerate); }

  bool					OpenGL() const throw()
  { return (this->_opengl); }
  bool					OpenGL(bool ogl) throw()
  { this->_opengl = ogl; return (this->_opengl); }

  ~Configuration() throw()
  {
  }


private:
  int unsigned			_width, _height;
  int short unsigned	_color;
  float					_ratiow, _ratioh;

  std::string			_caption;

  bool					_windowed, _vsync;
  int unsigned			_framerate;

  bool					_opengl;
};

# endif

#endif
